package cn.edu.qzit.linpq.base.service;

import cn.edu.qzit.linpq.base.dao.BaseMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * ClassName : cn.edu.qzit.linpq.base.service.BaseService
 * Desc : BaseService 用于规范所有的Service基础查询，便于后期AOP的实现
 *
 * @author : LINPQ
 * @date : 2022/6/18 14:36
 */
public class BaseService<T,M extends BaseMapper<T>> {

    @Autowired
    M mapper;

    public List<T> findList(){
        return mapper.list();
    }

    public int save(T t){
        return mapper.save(t);
    }

    public int delete(Integer id){
        return mapper.delete(id);
    }

    public int update(T t){
        return mapper.update(t);
    }

    public T findById(Integer id){
        return mapper.findById(id);
    }
}
